<template>
    <div class="MemuLayout">
        <el-menu default-active="1" class="el-menu-vertical-demo" :collapse="isCollapse">
            <div class="MemuSwitch" @click="isCollapse = !isCollapse">
                <el-button link class="Switch" :class="!isCollapse ? 'open' : ''">
                    <el-icon>
                        <ArrowRight />
                    </el-icon>
                </el-button>
            </div>
            <el-menu-item index="1" @click="ToMenu('/NetWorth')">
                <el-icon>
                    <Refrigerator />
                </el-icon>
                <span>资产</span>
            </el-menu-item>
            <el-menu-item index="2" @click="ToMenu('/BulkSell')">
                <el-icon>
                    <Shop />
                </el-icon>
                <span>销售</span>
            </el-menu-item>
            <el-menu-item index="3" @click="ToMenu('/Setting')">
                <el-icon>
                    <setting />
                </el-icon>
                <span>设置</span>
            </el-menu-item>
        </el-menu>
    </div>
</template>
  
<script  setup>
import { Refrigerator, Shop, Setting, ArrowRight } from '@element-plus/icons-vue'
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const isCollapse = ref(true);
const ToMenu = function (path) {
    router.push(path)
}
</script>
<style lang="less" scoped>
.Menu {
    position: relative;
}

.el-menu-vertical-demo {
    height: 100%;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 180px;
    min-height: 400px;
}

.MemuLayout {
    position: relative;
    height: 100%;
}


.Switch.open {
    transform: rotateZ(180deg);
}

.MemuSwitch {
    cursor: pointer;
    text-align: right;
    line-height: 48px;
    padding: 0 16px;
    height: 48px;
    border-bottom: solid 1px var(--el-menu-border-color);
}
</style>